package com.bruan.d1_io;

import java.io.FileInputStream;
import java.io.InputStream;

public class FileInputStreamTest1 {
    public static void main(String[] args) throws Exception{
        //创建管道[简化写法]
        InputStream inputStream =  new FileInputStream("file-io-app\\bruan.txt");
//        InputStream inputStream1 =  new FileInputStream(new File("file-io-app\\bruan.txt"));
        //读取字节 每次读取一个字节
//        int b1 = inputStream.read();
//        System.out.println((char)b1);
//        int b2 = inputStream.read();
//        System.out.println((char)b2);
//        int b3 = inputStream.read();
//        System.out.println((char)b3);
        //使用循环改造
        int b;
        while ((b=inputStream.read())!=-1){
            System.out.print((char) b);
        }
        inputStream.close();


    }
}
